package service;


import listboxlib.pageutils.PageBounds;
import model.TbTest;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Created by arcadia on 17-8-13.
 */
@Service
public class TestService {

    @Autowired
    SqlSessionFactory sqlSessionFactory;

    SqlSession sqlSession;
    public void showTestAll() {
        sqlSession = sqlSessionFactory.openSession();
        Map<String, Object> params = new HashMap();
        int page = 1; //页号
        int pageSize = 10; //每页数据条数
        PageBounds pageBounds = new PageBounds(page, pageSize);
        List<TbTest> tbTestList = sqlSession.selectList("dao.TbTestMapper.findTestAll", params, pageBounds);
        tbTestList.forEach(System.out::println);
        sqlSession.close();
    }
}
